package com.congee02.dbservlet.result;


public final class ResultFactory {

    private ResultFactory() {}

    private static <T> Result<T> createResult(boolean ok, T data, String msg) {
        return new Result<>(ok, data, msg);
    }

    public static Result<Void> failedResult(String msg) {
        return ResultFactory.createResult(false, null, msg);
    }

    public static <T> Result<T> successResult(T data) {
        return createResult(true, data, null);
    }

    public static Result<Void> successResult() {
        return successResult(null);
    }

}
